import {ActorState} from "db://assets/Script/Actor/ActorState";
import {StateEnum} from "db://assets/Script/Enums/StateEnum";
import {Vec2} from "cc"

export class Die extends ActorState {

    onEnter() {
        //设置当前刚体线性速度为0
        this.actor.rigidBody2D.linearVelocity = Vec2.ZERO
        this.actor.dead = true
    }

    onDestroy() {

    }

    onExit() {

    }

    /**
     * 死亡状态不能转为其他状态
     * @param to 其他状态
     */
    canTransition(to: StateEnum): boolean {
        return false
    }

    update(deltaTime: number) {
        return
    }
}
